﻿@{
    Layout = null;
    var x = Html.X();
    var treeRoot = new Node()
    {
        Text = ".",
        NodeID = "Root",
        Expanded = true,
        AutoDataBind = false,
        Checked = null
    };

    for (var i = 1; i < 9; i++)
    {
        treeRoot.Children.Add(new Node()
        {
            Text = "Node" + i,
            NodeID = "NodeID" + i
        });
    }
}


<script>
    
    function treeclick(view, record, item, index, e) {
        var centerContainer = view.panel.ownerCt.down("container[region='center']");
        var grid = centerContainer.down("grid");
        if (grid) {
            var store = grid.getStore();
            store.proxy.extraParams = { "TREEPATHCODE": record.raw.id };
            store.load();
        } else {
            var form = centerContainer.down("form");

            var params = { containerId: form.ownerCt.id };

            Ext.net.directRequest({
                cleanRequest: true,
                url: form.tag.RefreshUrl,
                extraParams: params,
                method: "GET",
                @*eventMask: {
                    showMask: true,
                    msg: "正在刷新..."
                },*@
                control: this
            });
        }
    }
</script>

@(
    x.Container().Layout(LayoutType.Border).Items(
            x.TreePanel()
                .Title("功能位置")
                .Region(Region.West)
                .Layout(LayoutType.Fit)
                .Width(225)
                .MinWidth(225)
                .MaxWidth(400)
                .Split(true)
                .Collapsible(false).RootVisible(false).HideHeaders(true).Animate(false)
                .Root(treeRoot)
                .ViewConfig(x.TreeView().LoadMask(false))
                .Listeners(l => l.ItemClick.Fn = "treeclick"),

            x.Container().Layout(LayoutType.Fit).Region(Region.Center)
            .ItemsFromSection(this, "tabContent", true)

    )
)